# -*- coding: utf-8 -*-
# @Time        :2024/11/5 上午11:18
# @Author      :文刀水寿
# @File        : 工厂模式.py
"""
 @Description :演示设计模式之工厂模式
"""


class Person:
    pass


class Worker:
    pass


class Teacher:
    pass


class Student:
    pass


class PersonFactory:
    def get_person(self, p_type):
        if p_type == 'w':
            return Worker()
        elif p_type == 's':
            return Student()
        else:
            return Teacher()


pf = PersonFactory()
worker = pf.get_person('w')
stu = pf.get_person('s')
teacher = pf.get_person('t')
